#####此方法管用
FROM php:7.4-fpm-buster

# #添加阿里云镜像
ADD apt-list /opt/

# # 安装扩展包



RUN cp /etc/apt/sources.list /etc/apt/sources.list.bak \ 
    && cat /opt/apt-list >/etc/apt/sources.list \ 
    && apt-get update && apt-get install -y libzip-dev zip libfreetype6-dev libjpeg62-turbo-dev libmcrypt-dev libpng-dev cron supervisor \
    && rm -rf /var/lib/apt/lists/* \
    && docker-php-ext-configure gd \
    && docker-php-ext-configure zip \
    && docker-php-ext-install gd mysqli pdo_mysql zip opcache bcmath iconv

RUN apt-get install -y nodejs npm \
    && npm config set registry https://registry.npm.taobao.org --global

# RUN pecl install swoole \
# 	&& pecl install mcrypt \
# 	&& pecl install inotify \
#     && docker-php-ext-enable  swoole inotify mcrypt

RUN pecl install redis && docker-php-ext-enable redis  

# #创建supervisor为容器启动多进程
# RUN mkdir -p /var/log/supervisor
# RUN mkdir -p /www
# WORKDIR /www
# RUN chown -R www-data:www-data /www
# #配置定时任务

# # 复制配置文件 /var/spool/cron/crontabs/

# COPY ./crontab /var/spool/cron/crontabs/root
# # 设置文件所有者和文件关联组为 root:crontab ，关联组必须为 crontab
# RUN chown -R root:crontab /var/spool/cron/crontabs/root \
#     && chmod 600 /var/spool/cron/crontabs/root \
#     && touch /var/log/cron.log \
#     && crontab /var/spool/cron/crontabs/root


# #扩展配置*.ini

# COPY ./conf.d/opcache.ini /usr/local/etc/php/
# COPY ./conf.d/phpcustom.ini /usr/local/etc/php/

# CMD ["/usr/bin/supervisord"]




# FROM php:5.5-fpm

# You may need proxy
# RUN export http_proxy=192.168.1.10:1080
# RUN export https_proxy=192.168.1.10:1080

# Update ubuntu
# RUN apt-get update

# # mcrypt
# RUN apt-get install -y libmcrypt-dev
# RUN docker-php-ext-install mcrypt

# # GD
# RUN apt-get install -y libfreetype6-dev libjpeg62-turbo-dev libpng12-dev
# RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/
# #RUN docker-php-ext-install -j$(nproc) gd
# RUN docker-php-ext-install gd

# # Intl
# RUN apt-get install -y libicu-dev
# RUN docker-php-ext-install -j$(nproc) intl
# #RUN docker-php-ext-install intl

# # General
# RUN docker-php-ext-install zip
# RUN docker-php-ext-install pcntl
# RUN docker-php-ext-install opcache
# RUN docker-php-ext-install mysql
# RUN docker-php-ext-install pdo_mysql
# RUN docker-php-ext-install mysqli
# RUN docker-php-ext-install mbstring
# # SOAP Client
# RUN apt-get install -y libxml2-dev
# RUN docker-php-ext-install soap

# General extensions that may had be installed default
# If not, install them with following command
#RUN docker-php-ext-install ctype
#RUN docker-php-ext-install dom
#RUN docker-php-ext-install fileinfo
#RUN docker-php-ext-install ftp
#RUN docker-php-ext-install hash
#RUN docker-php-ext-install iconv
#RUN docker-php-ext-install json
#RUN docker-php-ext-install mbstring
#RUN docker-php-ext-install pdo
#RUN docker-php-ext-install pdo_sqlite
#RUN docker-php-ext-install posix
#RUN docker-php-ext-install session
#RUN docker-php-ext-install tokenizer
#RUN docker-php-ext-install simplexml
#RUN docker-php-ext-install xml
#RUN docker-php-ext-install xmlreader
#RUN docker-php-ext-install xmlwriter

# CURL, may had be installed default
#RUN apt-get install -y curl
#RUN apt-get install -y libcurl3
#RUN apt-get install -y libcurl4-openssl-dev
#RUN docker-php-ext-install curl

# More extensions
#RUN docker-php-ext-install exif
#RUN docker-php-ext-install bcmath
#RUN docker-php-ext-install calendar
#RUN docker-php-ext-install sockets
#RUN docker-php-ext-install gettext
#RUN docker-php-ext-install phar
#RUN docker-php-ext-install shmop
#RUN docker-php-ext-install sysvmsg
#RUN docker-php-ext-install sysvsem
#RUN docker-php-ext-install sysvshm

# More extensions handle database
#RUN docker-php-ext-install pdo_firebird
#RUN docker-php-ext-install pdo_dblib
#RUN docker-php-ext-install pdo_oci
#RUN docker-php-ext-install pdo_odbc
#RUN docker-php-ext-install pdo_pgsql
#RUN docker-php-ext-install pgsql
#RUN docker-php-ext-install oci8
#RUN docker-php-ext-install odbc
#RUN docker-php-ext-install dba
#RUN docker-php-ext-install interbase

# execute `RUN apt-get install -y libxml2-dev` before using following command
#RUN apt-get install -y libxslt-dev
#RUN docker-php-ext-install xsl
#RUN docker-php-ext-install xmlrpc
#RUN docker-php-ext-install wddx

# Readline
#RUN apt-get install -y libreadline-dev
#RUN docker-php-ext-install readline

# SNMP
#RUN apt-get install -y libsnmp-dev
#RUN apt-get install -y snmp
#RUN docker-php-ext-install snmp

# pspell
#RUN apt-get install -y libpspell-dev
#RUN apt-get install -y aspell-en
#RUN docker-php-ext-install pspell

# recode
#RUN apt-get install -y librecode0
#RUN apt-get install -y librecode-dev
#RUN docker-php-ext-install recode

# Tidy
#RUN apt-get install -y libtidy-dev
#RUN docker-php-ext-install tidy

# GMP
#RUN apt-get install -y libgmp-dev
#RUN docker-php-ext-install gmp

# Client
#RUN apt-get install -y postgresql-client
#RUN apt-get install -y mysql-client

# IMAP
#RUN apt-get install -y libc-client-dev
#RUN docker-php-ext-configure imap --with-kerberos --with-imap-ssl
#RUN docker-php-ext-install imap

# LDAP
#RUN apt-get install -y libldb-dev
#RUN apt-get install -y libldap2-dev
#RUN docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu
#RUN docker-php-ext-install ldap

# Composer
#RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin/ --filename=composer

# XDEBUG
#RUN yes | pecl channel-update pecl.php.net && pecl install xdebug \
#    && echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" > /usr/local/etc/php/conf.d/xdebug.ini \
#    && echo "xdebug.remote_enable=on" >> /usr/local/etc/php/conf.d/xdebug.ini \
#    && echo "xdebug.remote_handler=dbgp" >> /usr/local/etc/php/conf.d/xdebug.ini
#    && echo "xdebug.xdebug.remote_host=127.0.0.1" >> /usr/local/etc/php/conf.d/xdebug.ini
#    && echo "xdebug.xdebug.remote_port=9000" >> /usr/local/etc/php/conf.d/xdebug.ini
